import 'package:flutter/material.dart';

class Snake extends StatelessWidget {
  const Snake({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: _MyHomePage(),
      appBar: AppBar(
        title: Text('贪吃蛇'),
      ),
    );
  }
}

class _MyHomePage extends StatefulWidget {
  const _MyHomePage({Key? key}) : super(key: key);

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<_MyHomePage> {
  Offset baLL = Offset.zero;
  List<Offset> snakeList = [Offset(50, 0), Offset(60, 0)];

  const double size = 10;

  @override
  Widget build(BuildContext context) {
    return Stack(
      children: snakeList
          .map(
            (e) => Positioned.fromRect(
              rect: Rect.fromCenter(center: snake, width: 10, height: 10),
              child: Container(
                color: Colors.black,
              ),
            ),
          )
          .toList()
            ..add(Positioned.fromRect(
              rect: Rect.fromCenter(center: snake, width: 10, height: 10),
              child: Container(
                color: Colors.orange,
              ),
            )),
    );
  }
}


Offset adjust {



}